package com.hxl.tech.gateway.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

public class AppConstant {

    /**
     * 资源配置
     */
    public static final String RESOURCE_MERCHANT_DEFAULT = "default";
    public static final String RESOURCE_OPEN_URL = "openUrl";
    public static final String RESOURCE_IP_LIMIT = "ipLimit";

    /**
     * 应用信息
     */
    public static final String APP_ID = "app_id";
    public static final String CLIENT_ID = "client_id";
    public static final String MERCHANT_CODE = "merchant_code";
    public static final String API_NAME = "api_name";
    public static final String APP_TYPE_SYSTEM = "SYSTEM";
    public static final String APP_TYPE_DEV = "DEV";

    /**
     * 角色信息
     */
    public static final String ROLE_DEVELOPER = "开发者";
    public static final String ROLE_ADMIN = "管理员";
    public static final String ROLE_OPEN_SYSTEM_CODE = "role_system";
    public static final String ROLE_OPEN_DEV_CODE = "role_dev";
    public static final String ROLE_OPEN_INVALID_CODE = "role_invalid";

    /**
     * HEADER属性配置
     */
    public static final String HEADER_OPEN = "Open-";
    public static final String HEADER_OPEN_MERCHANT_TYPE = HEADER_OPEN + "Merchant-Type";
    public static final String HEADER_OPEN_MERCHANT_CODE = HEADER_OPEN + "Merchant-Code";
    public static final String HEADER_OPEN_APP_ID = HEADER_OPEN + "App-Id";

    /**
     * Redis Key
     */
    public static final String REDIS_USER_TOKEN = "auth.user.token:";
    public static final String REDIS_SMS_CODE = "auth.sms.code:";
    public static final String REDIS_SMS_CODE_COUNT = "auth.sms.code.count:";
    public static final String REDIS_OPEN_URL_PREFIX = "gateway.url:";
    public static final String REDIS_APP_PREFIX = "gateway.apps:";
    public static final String REDIS_API_PREFIX = "gateway.apis:";
    public static final String REDIS_API_APPROVAL_PREFIX = "gateway.approval.apis:";
    public static final String REDIS_LIMIT_IP_RULE = "gateway.limit.ip.rule";
    public static final String REDIS_LIMIT_RATE_RULE = "gateway.limit.rate.rule:";

    /**
     * 主键ID前缀
     */
    public static final String PREFIX_USER = "US";
    public static final String PREFIX_RULE = "LR";

    public enum StateEnum {
        INIT, ENABLE, DISABLE;
        public static final String description = "状态：INIT(未激活),ENABLE(启用),DISABLE(禁用)";

        public String getName(){
            switch (this){
                case INIT:return "未激活";
                case ENABLE:return "启用";
                case DISABLE:return "禁用";

            }
            return null;
        }
    }
}
